package com.itheima.mapper;

import com.itheima.pojo.Student;
import com.itheima.pojo.User;
import org.apache.ibatis.annotations.*;

import java.awt.print.Book;
import java.util.List;

/**
 * @author ChaunceyZhang
 */
@Mapper
public interface StudentMapper {


    @Select("select * from t_user where name = #{name}  AND password = #{password}")
    User select(@Param("name") String name, @Param("password")  String password);

    @Insert("insert into t_student (name,sex, age,address) values (#{name},#{sex},#{age}, #{address})")
    int save(Student student);

    @Update("update t_student set name = #{name}, sex = #{sex}, age = #{age}, address = #{address} where id = #{id}")
    int update(Student student);

    @Delete("delete from t_student where id = #{id}")
    int delete(Integer id);

    @Select("select * from t_student where id = #{id}")
    Book findById(Integer id);

    @Select("select * from t_student")
    List<Student> findAll();
}
